<html>
<head>
    <title>g-meeetings app</title>
    <meta name="layout" content="main"/>
    <style type="text/css" media="screen">

    #nav {
        margin-top: 20px;
        margin-left: 30px;
        width: 228px;
        float: left;

    }

    .homePagePanel * {
        margin: 0px;
    }

    .homePagePanel .panelBody ul {
        list-style-type: none;
        margin-bottom: 10px;
    }

    .homePagePanel .panelBody h1 {
        text-transform: uppercase;
        font-size: 1.1em;
        margin-bottom: 10px;
    }

    .homePagePanel .panelBody {
        background: url(images/leftnav_midstretch.png) repeat-y top;
        margin: 0px;
        padding: 15px;
    }

    .homePagePanel .panelBtm {
        background: url(images/leftnav_btm.png) no-repeat top;
        height: 20px;
        margin: 0px;
    }

    .homePagePanel .panelTop {
        background: url(images/leftnav_top.png) no-repeat top;
        height: 11px;
        margin: 0px;
    }

    h2 {
        margin-top: 15px;
        margin-bottom: 15px;
        font-size: 1.2em;
    }

    #pageBody {
        margin-left: 280px;
        margin-right: 20px;
    }


    </style>
</head>

<body>

<div id="nav">
    <div class="homePagePanel">
        <div class="panelTop"></div>

        <div class="panelBody">
            <ul>
                <li>
                    <g:link controller="meeting">Meetings</g:link>
                </li>
                <sec:ifAllGranted roles="ROLE_ADMIN">
                    <li>
                        <g:link controller="location">Locations</g:link>
                    </li>
                    <li>
                        <g:link controller="user">Users</g:link>
                    </li>
                </sec:ifAllGranted>
            </ul>
        </div>

        <div class="panelBtm">

        </div>
    </div>
</div>

<div id="pageBody">
    <h1>Going Meeting List</h1>

    <div class="list">
        <table>
            <thead>
            <tr>
                <th>Id</th>
                <th>Topic</th>
                <th>Start Date</th>
                <th>End Date</th>
                <th>Owner</th>
                <th>Location</th>
                <th>Participants</th>
                <th>Decline</th>
            </tr>
            </thead>
            <tbody>
            <g:each in="${goingMeetings}" status="i" var="meeting">
                <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
                    <td><g:link controller="meeting" action="show"
                                id="${meeting.id}">${fieldValue(bean: meeting, field: "id")}</g:link></td>
                    <td>${fieldValue(bean: meeting, field: "topic")}</td>
                    <td>${fieldValue(bean: meeting, field: "startDate")}</td>
                    <td>${fieldValue(bean: meeting, field: "endDate")}</td>
                    <td>${fieldValue(bean: meeting, field: "owner")}</td>
                    <td>${fieldValue(bean: meeting, field: "location")}</td>
                    <td>
                        <ul>
                            <g:each in="${meeting.participants}" var="p">
                                <li><g:link controller="user" action="show"
                                            id="${p.id}">${p?.encodeAsHTML()}</g:link></li>
                            </g:each>
                        </ul>
                    </td>
                    <td><g:link controller="home" action="declineMeeting"
                                params="[id: meeting.id]">Decline</g:link></td>

                </tr>
            </g:each>
            </tbody>
        </table>
    </div>

    <h1>Invited Meeting List</h1>

    <div class="list">
        <table>
            <thead>
            <tr>
                <th>Id</th>
                <th>Topic</th>
                <th>Start Date</th>
                <th>End Date</th>
                <th>Owner</th>
                <th>Location</th>
                <th>Participants</th>
                <th>Accept</th>
            </tr>
            </thead>
            <tbody>
            <g:each in="${invitedMeetings}" status="i" var="meeting">
                <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
                    <td><g:link controller="meeting" action="show"
                                id="${meeting.id}">${fieldValue(bean: meeting, field: "id")}</g:link></td>
                    <td>${fieldValue(bean: meeting, field: "topic")}</td>
                    <td>${fieldValue(bean: meeting, field: "startDate")}</td>
                    <td>${fieldValue(bean: meeting, field: "endDate")}</td>
                    <td>${fieldValue(bean: meeting, field: "owner")}</td>
                    <td>${fieldValue(bean: meeting, field: "location")}</td>
                    <td>
                        <ul>
                            <g:each in="${meeting.participants}" var="p">
                                <li><g:link controller="user" action="show"
                                            id="${p.id}">${p?.encodeAsHTML()}</g:link></li>
                            </g:each>
                        </ul>
                    </td>
                    <td><g:link controller="home" action="acceptMeeting"
                                params="['id': meeting.id]">Accept</g:link></td>
                </tr>
            </g:each>
            </tbody>
        </table>
    </div>


    <h1>My Meeting List</h1>

    <div class="list">
        <table>
            <thead>
            <tr>
                <th>Id</th>
                <th>Topic</th>
                <th>Start Date</th>
                <th>End Date</th>
                <th>Owner</th>
                <th>Location</th>
                <th>Participants</th>

            </tr>
            </thead>
            <tbody>
            <g:each in="${myMeetings}" status="i" var="meeting">
                <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
                    <td><g:link controller="meeting" action="show"
                                id="${meeting.id}">${fieldValue(bean: meeting, field: "id")}</g:link></td>
                    <td>${fieldValue(bean: meeting, field: "topic")}</td>
                    <td>${fieldValue(bean: meeting, field: "startDate")}</td>
                    <td>${fieldValue(bean: meeting, field: "endDate")}</td>
                    <td>${fieldValue(bean: meeting, field: "owner")}</td>
                    <td>${fieldValue(bean: meeting, field: "location")}</td>
                    <td>
                        <ul>
                            <g:each in="${meeting.participants}" var="p">
                                <li><g:link controller="user" action="show"
                                            id="${p.id}">${p?.encodeAsHTML()}</g:link></li>
                            </g:each>
                        </ul>
                    </td>
                </tr>
            </g:each>
            </tbody>
        </table>
    </div>
</div>
</body>
</html>
